from src.utils.loggers import test_logger
from nicegui import ui
from src.app import APP
from src.views.home import g_main_window
from src.utils.loggers import app_init_logger
from src.database.db_engine import test_db
from src.database.data_chuli import get_file_path, read_excel_data, refresh_database, saveColumnVinDict, read_database
import secrets


# test_db()
# file_path = get_file_path()
# print(file_path)
# df, columnVinDict = read_excel_data()
# saveColumnVinDict('F06', columnVinDict)
# print(df)
# print(columnVinDict)

# refresh_database(df)

# df = read_database()
# print(df)


if 1:
    app = APP()
    app.set_NiceGUIApp()

    @ui.page('/')
    def home():
        """主页路由"""
        g_main_window.set_APP(app)
        g_main_window.build()
        app_init_logger.info("通用页面布局已加载！")

    ui.run(title='坐标分析系统', storage_secret=secrets.token_urlsafe(16))
